/*
 * Database.h
 *
 *  Created on: 17-08-2011
 *      Author: cristian
 */

#ifndef DATABASE_H_
#define DATABASE_H_

#include "leveldb/db.h"
#include "Logger.h"
#include <pthread.h>

class Database {

private:

	pthread_mutex_t mutex;
	leveldb::Status status;
	leveldb::DB* db;
	leveldb::Options options;
	static Database* INSTANCE;

public:

	static Database* getInstance();
	Logger* logger;
	leveldb::Status getStatus() const;
	void setStatus(leveldb::Status status);
	Logger *getLogger() const;
	void setLogger(Logger *logger);
	Database();
	virtual ~Database();
	leveldb::DB *getDb() const;
	leveldb::Options getOptions() const;
	void setDb(leveldb::DB *db);
	void setOptions(leveldb::Options options);
	void put(std::string _key, std::string _value);
	std::string get(std::string _key);
	void printAll();
};

#endif /* DATABASE_H_ */
